/*
C bindings for the FMod event engine
Copyright (C) 2007 David Wallin

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*/

#define __BUILD_FMOD_EVENT_C_H__
#include <fmod/fmod_event.h>
#include <fmod/fmod_event_c.h>
#include <fmod/fmod.hpp>

/*
    FMOD Event System factory function.  Use this to create an FMOD Event System Instance.  below you will see FMOD_EventSystem_Init/Release to get started.
*/

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_Create                  (FMOD_EVENTSYSTEM **system)
{
    FMOD::EventSystem* newSystem;
    FMOD_RESULT result = EventSystem_Create(&newSystem);
    (*system) = reinterpret_cast<FMOD_EVENTSYSTEM*>(newSystem);
    
    return result;
}


/*
    'EventSystem' API
*/

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_Init                    (FMOD_EVENTSYSTEM *system, int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata, EVENT_INITFLAGS eventflags)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->init(maxchannels, flags, extradriverdata, eventflags);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_Release                 (FMOD_EVENTSYSTEM *system)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->release();
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_Update                  (FMOD_EVENTSYSTEM *system)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->update();
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_SetMediaPath            (FMOD_EVENTSYSTEM *system, const char *path)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->setMediaPath(path);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_SetPluginPath           (FMOD_EVENTSYSTEM *system, const char *path)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->setPluginPath(path);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetVersion              (FMOD_EVENTSYSTEM *system, unsigned int *version)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->getVersion(version);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetInfo                 (FMOD_EVENTSYSTEM *system, FMOD::EVENT_SYSTEMINFO *info)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->getInfo(info);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetSystemObject         (FMOD_EVENTSYSTEM *system, FMOD_SYSTEM **f_system)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD::System* new_f_system = reinterpret_cast<FMOD::System*>((*f_system));
    FMOD_RESULT result = e_system->getSystemObject(&new_f_system);
    (*f_system) = reinterpret_cast<FMOD_SYSTEM*>(new_f_system);
    
    return result;
}


FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_Load                    (FMOD_EVENTSYSTEM *system, const char *filename, FMOD::EVENT_LOADINFO *loadinfo, FMOD_EVENTPROJECT **project)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result;

    if(project != 0)
    {
        FMOD::EventProject* e_project = reinterpret_cast<FMOD::EventProject*>((*project));
        result = e_system->load(filename, loadinfo, &e_project);
        (*project) = reinterpret_cast<FMOD_EVENTPROJECT*>(e_project);
    }
    else
    {
        result = e_system->load(filename, loadinfo, 0);
    }
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_Unload                  (FMOD_EVENTSYSTEM *system)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->unload();
    
    return result;
}


FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetProject              (FMOD_EVENTSYSTEM *system, const char *name, FMOD_EVENTPROJECT **project)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD::EventProject* e_project = reinterpret_cast<FMOD::EventProject*>((*project));
    FMOD_RESULT result = e_system->getProject(name, &e_project);
    (*project) = reinterpret_cast<FMOD_EVENTPROJECT*>(e_project);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetProjectByIndex       (FMOD_EVENTSYSTEM *system, int index, FMOD_EVENTPROJECT **project)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD::EventProject* e_project = reinterpret_cast<FMOD::EventProject*>((*project));
    FMOD_RESULT result = e_system->getProjectByIndex(index, &e_project);
    (*project) = reinterpret_cast<FMOD_EVENTPROJECT*>(e_project);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetNumProjects          (FMOD_EVENTSYSTEM *system, int *numprojects)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->getNumProjects(numprojects);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetCategory             (FMOD_EVENTSYSTEM *system, const char *name, FMOD_EVENTCATEGORY **category)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>((*category));
    FMOD_RESULT result = e_system->getCategory(name, &e_category);
    (*category) = reinterpret_cast<FMOD_EVENTCATEGORY*>(e_category);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetCategoryByIndex      (FMOD_EVENTSYSTEM *system, int index, FMOD_EVENTCATEGORY **category)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>((*category));
    FMOD_RESULT result = e_system->getCategoryByIndex(index, &e_category);
    (*category) = reinterpret_cast<FMOD_EVENTCATEGORY*>(e_category);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetNumCategories        (FMOD_EVENTSYSTEM *system, int *numcategories)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->getNumCategories(numcategories);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetReverb               (FMOD_EVENTSYSTEM *system, const char *name, FMOD_EVENTREVERB **reverb)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD::EventReverb* e_reverb = reinterpret_cast<FMOD::EventReverb*>((*reverb));
    FMOD_RESULT result = e_system->getReverb(name, &e_reverb);
    (*reverb) = reinterpret_cast<FMOD_EVENTREVERB*>(e_reverb);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetReverbByIndex        (FMOD_EVENTSYSTEM *system, const int index,  FMOD_EVENTREVERB **reverb)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD::EventReverb* e_reverb = reinterpret_cast<FMOD::EventReverb*>((*reverb));
    FMOD_RESULT result = e_system->getReverbByIndex(index, &e_reverb);
    (*reverb) = reinterpret_cast<FMOD_EVENTREVERB*>(e_reverb);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetNumReverbs           (FMOD_EVENTSYSTEM *system, int *numreverbs)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->getNumReverbs(numreverbs);
    
    return result;
}


FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetGroup                (FMOD_EVENTSYSTEM *system, const char *name, bool cacheevents, FMOD_EVENTGROUP **group)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>((*group));
    FMOD_RESULT result = e_system->getGroup(name, cacheevents, &e_group);
    (*group) = reinterpret_cast<FMOD_EVENTGROUP*>(e_group);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetEvent                (FMOD_EVENTSYSTEM *system, const char *name, EVENT_MODE mode, FMOD_EVENT **event)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>((*event));
    FMOD_RESULT result = e_system->getEvent(name, mode, &e_event);
    (*event) = reinterpret_cast<FMOD_EVENT*>(e_event);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetEventBySystemID      (FMOD_EVENTSYSTEM *system, unsigned int systemid, EVENT_MODE mode, FMOD_EVENT **event)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>((*event));
    FMOD_RESULT result = e_system->getEventBySystemID(systemid, mode, &e_event);
    (*event) = reinterpret_cast<FMOD_EVENT*>(e_event);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_GetNumEvents            (FMOD_EVENTSYSTEM *system, int *numevents)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->getNumEvents(numevents);
    
    return result;
}


FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_Set3DNumListeners       (FMOD_EVENTSYSTEM *system, int numlisteners)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->set3DNumListeners(numlisteners);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_Get3DNumListeners       (FMOD_EVENTSYSTEM *system, int *numlisteners)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->get3DNumListeners(numlisteners);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_Set3DListenerAttributes (FMOD_EVENTSYSTEM *system, int listener, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel, const FMOD_VECTOR *forward, const FMOD_VECTOR *up)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->set3DListenerAttributes(listener, pos, vel, forward, up);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_Get3DListenerAttributes (FMOD_EVENTSYSTEM *system, int listener, FMOD_VECTOR *pos, FMOD_VECTOR *vel, FMOD_VECTOR *forward, FMOD_VECTOR *up)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->get3DListenerAttributes(listener, pos, vel, forward, up);
    
    return result;
}


FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_RegisterMemoryFSB       (FMOD_EVENTSYSTEM *system, const char *filename, void *fsbdata, unsigned int fsbdatalen)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->registerMemoryFSB(filename, fsbdata, fsbdatalen);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventSystem_UnregisterMemoryFSB     (FMOD_EVENTSYSTEM *system, const char *filename)
{
    FMOD::EventSystem* e_system = reinterpret_cast<FMOD::EventSystem*>(system);
    FMOD_RESULT result = e_system->unregisterMemoryFSB(filename);
    
    return result;
}



/*
    'EventProject' API
*/

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventProject_Release                (FMOD_EVENTPROJECT *project)
{
    FMOD::EventProject* e_project = reinterpret_cast<FMOD::EventProject*>(project);
    FMOD_RESULT result = e_project->release();
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventProject_GetInfo                (FMOD_EVENTPROJECT *project, int *index, char **name)
{
    FMOD::EventProject* e_project = reinterpret_cast<FMOD::EventProject*>(project);
    FMOD_RESULT result = e_project->getInfo(index, name);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventProject_GetGroup               (FMOD_EVENTPROJECT *project, const char *name, bool cacheevents, FMOD_EVENTGROUP **group)
{
    FMOD::EventProject* e_project = reinterpret_cast<FMOD::EventProject*>(project);
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>((*group));
    FMOD_RESULT result = e_project->getGroup(name, cacheevents, &e_group);
    (*group) = reinterpret_cast<FMOD_EVENTGROUP*>(e_group);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventProject_GetGroupByIndex        (FMOD_EVENTPROJECT *project, int index,        bool cacheevents, FMOD_EVENTGROUP **group)
{
    FMOD::EventProject* e_project = reinterpret_cast<FMOD::EventProject*>(project);
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>((*group));
    FMOD_RESULT result = e_project->getGroupByIndex(index, cacheevents, &e_group);
    (*group) = reinterpret_cast<FMOD_EVENTGROUP*>(e_group);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventProject_GetNumGroups           (FMOD_EVENTPROJECT *project, int *numgroups)
{
    FMOD::EventProject* e_project = reinterpret_cast<FMOD::EventProject*>(project);
    FMOD_RESULT result = e_project->getNumGroups(numgroups);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventProject_GetEvent               (FMOD_EVENTPROJECT *project, const char *name, EVENT_MODE mode, FMOD_EVENT **event)
{
    FMOD::EventProject* e_project = reinterpret_cast<FMOD::EventProject*>(project);
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>((*event));
    FMOD_RESULT result = e_project->getEvent(name, mode, &e_event);
    (*event) = reinterpret_cast<FMOD_EVENT*>(e_event);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventProject_GetEventByProjectID    (FMOD_EVENTPROJECT *project, unsigned int projectid, EVENT_MODE mode, FMOD_EVENT **event)
{
    FMOD::EventProject* e_project = reinterpret_cast<FMOD::EventProject*>(project);
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>((*event));
    FMOD_RESULT result = e_project->getEventByProjectID(projectid, mode, &e_event);
    (*event) = reinterpret_cast<FMOD_EVENT*>(e_event);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventProject_GetNumEvents           (FMOD_EVENTPROJECT *project, int *numevents)
{
    FMOD::EventProject* e_project = reinterpret_cast<FMOD::EventProject*>(project);
    FMOD_RESULT result = e_project->getNumEvents(numevents);
    
    return result;
}



/*
    'EventGroup' API
*/

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_GetInfo                  (FMOD_EVENTGROUP *group, int *index, char **name)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(group);
    FMOD_RESULT result = e_group->getInfo(index, name);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_LoadEventData            (FMOD_EVENTGROUP *group, FMOD::EVENT_RESOURCE resource, EVENT_MODE mode)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(group);
    FMOD_RESULT result = e_group->loadEventData(resource, mode);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_FreeEventData            (FMOD_EVENTGROUP *group, FMOD_EVENT *event)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(group);
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_group->freeEventData(e_event);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_GetGroup                 (FMOD_EVENTGROUP *source_group, const char *name, bool cacheevents, FMOD_EVENTGROUP **target_group)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(source_group);
    FMOD::EventGroup* t_group = reinterpret_cast<FMOD::EventGroup*>((*target_group));
    FMOD_RESULT result = e_group->getGroup(name, cacheevents, &t_group);
    (*target_group) = reinterpret_cast<FMOD_EVENTGROUP*>(t_group);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_GetGroupByIndex          (FMOD_EVENTGROUP *source_group, int index,        bool cacheevents, FMOD_EVENTGROUP **target_group)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(source_group);
    FMOD::EventGroup* t_group = reinterpret_cast<FMOD::EventGroup*>((*target_group));
    FMOD_RESULT result = e_group->getGroupByIndex(index, cacheevents, &t_group);
    (*target_group) = reinterpret_cast<FMOD_EVENTGROUP*>(t_group);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_GetParentGroup           (FMOD_EVENTGROUP *source_group, FMOD_EVENTGROUP **target_group)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(source_group);
    FMOD::EventGroup* t_group = reinterpret_cast<FMOD::EventGroup*>((*target_group));
    FMOD_RESULT result = e_group->getParentGroup(&t_group);
    (*target_group) = reinterpret_cast<FMOD_EVENTGROUP*>(t_group);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_GetParentProject         (FMOD_EVENTGROUP *group, FMOD_EVENTPROJECT **project)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(group);
    FMOD::EventProject* e_project = reinterpret_cast<FMOD::EventProject*>((*project));
    FMOD_RESULT result = e_group->getParentProject(&e_project);
    (*project) = reinterpret_cast<FMOD_EVENTPROJECT*>(e_project);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_GetNumGroups             (FMOD_EVENTGROUP *group, int *numgroups)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(group);
    FMOD_RESULT result = e_group->getNumGroups(numgroups);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_GetEvent                 (FMOD_EVENTGROUP *group, const char *name, EVENT_MODE mode, FMOD_EVENT **event)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(group);
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>((*event));
    FMOD_RESULT result = e_group->getEvent(name, mode, &e_event);
    (*event) = reinterpret_cast<FMOD_EVENT*>(e_event);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_GetEventByIndex          (FMOD_EVENTGROUP *group, int index,        EVENT_MODE mode, FMOD_EVENT **event)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(group);
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>((*event));
    FMOD_RESULT result = e_group->getEventByIndex(index, mode, &e_event);
    (*event) = reinterpret_cast<FMOD_EVENT*>(e_event);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_GetNumEvents             (FMOD_EVENTGROUP *group, int *numevents)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(group);
    FMOD_RESULT result = e_group->getNumEvents(numevents);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_GetProperty              (FMOD_EVENTGROUP *group, const char *propertyname, void *value)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(group);
    FMOD_RESULT result = e_group->getProperty(propertyname, value);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_GetPropertyByIndex       (FMOD_EVENTGROUP *group, int propertyindex, void *value)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(group);
    FMOD_RESULT result = e_group->getPropertyByIndex(propertyindex, value);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventGroup_GetNumProperties         (FMOD_EVENTGROUP *group, int *numproperties)
{
    FMOD::EventGroup* e_group = reinterpret_cast<FMOD::EventGroup*>(group);
    FMOD_RESULT result = e_group->getNumProperties(numproperties);
    
    return result;
}


/*
    'EventCategory' API
*/

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_GetInfo               (FMOD_EVENTCATEGORY *category, int *index, char **name)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(category);
    FMOD_RESULT result = e_category->getInfo(index, name);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_GetCategory           (FMOD_EVENTCATEGORY *source_category, const char *name, FMOD_EVENTCATEGORY **target_category)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(source_category);
    FMOD::EventCategory* t_category = reinterpret_cast<FMOD::EventCategory*>((*target_category));
    FMOD_RESULT result = e_category->getCategory(name, &t_category);
    (*target_category) = reinterpret_cast<FMOD_EVENTCATEGORY*>(t_category);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_GetCategoryByIndex    (FMOD_EVENTCATEGORY *source_category, int index,        FMOD_EVENTCATEGORY **target_category)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(source_category);
    FMOD::EventCategory* t_category = reinterpret_cast<FMOD::EventCategory*>((*target_category));
    FMOD_RESULT result = e_category->getCategoryByIndex(index, &t_category);
    (*target_category) = reinterpret_cast<FMOD_EVENTCATEGORY*>(t_category);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_GetNumCategories      (FMOD_EVENTCATEGORY *category, int *numcategories)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(category);
    FMOD_RESULT result = e_category->getNumCategories(numcategories);
    
    return result;
}


FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_StopAllEvents         (FMOD_EVENTCATEGORY *category)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(category);
    FMOD_RESULT result = e_category->stopAllEvents();
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_SetVolume             (FMOD_EVENTCATEGORY *category, float volume)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(category);
    FMOD_RESULT result = e_category->setVolume(volume);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_GetVolume             (FMOD_EVENTCATEGORY *category, float *volume)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(category);
    FMOD_RESULT result = e_category->getVolume(volume);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_SetPitch              (FMOD_EVENTCATEGORY *category, float pitch)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(category);
    FMOD_RESULT result = e_category->setPitch(pitch);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_GetPitch              (FMOD_EVENTCATEGORY *category, float *pitch)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(category);
    FMOD_RESULT result = e_category->getPitch(pitch);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_SetPaused             (FMOD_EVENTCATEGORY *category, bool paused)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(category);
    FMOD_RESULT result = e_category->setPaused(paused);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_GetPaused             (FMOD_EVENTCATEGORY *category, bool *paused)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(category);
    FMOD_RESULT result = e_category->getPaused(paused);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_SetMute               (FMOD_EVENTCATEGORY *category, bool mute)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(category);
    FMOD_RESULT result = e_category->setMute(mute);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_GetMute               (FMOD_EVENTCATEGORY *category, bool *mute)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(category);
    FMOD_RESULT result = e_category->getMute(mute);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventCategory_GetChannelGroup       (FMOD_EVENTCATEGORY *category, FMOD_CHANNELGROUP **channelgroup)
{
    FMOD::EventCategory* e_category = reinterpret_cast<FMOD::EventCategory*>(category);
    FMOD::ChannelGroup* t_channelgroup = reinterpret_cast<FMOD::ChannelGroup*>((*channelgroup));
    FMOD_RESULT result = e_category->getChannelGroup(&t_channelgroup);
    (*channelgroup) = reinterpret_cast<FMOD_CHANNELGROUP*>(t_channelgroup);
    
    return result;
}


/*
    'Event' API
*/

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_Start                         (FMOD_EVENT *event)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->start();
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_Stop                          (FMOD_EVENT *event, bool immediate)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->stop(immediate);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetInfo                       (FMOD_EVENT *event, int *index, char **name, FMOD::EVENT_INFO *info)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->getInfo(index, name, info);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetState                      (FMOD_EVENT *event, EVENT_STATE *state)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->getState(state);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetParentGroup                (FMOD_EVENT *event, FMOD_EVENTGROUP **group)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD::EventGroup* t_group = reinterpret_cast<FMOD::EventGroup*>((*group));
    FMOD_RESULT result = e_event->getParentGroup(&t_group);
    (*group) = reinterpret_cast<FMOD_EVENTGROUP*>(t_group);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetChannelGroup               (FMOD_EVENT *event, FMOD_CHANNELGROUP **channelgroup)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD::ChannelGroup* t_group = reinterpret_cast<FMOD::ChannelGroup*>((*channelgroup));
    FMOD_RESULT result = e_event->getChannelGroup(&t_group);
    (*channelgroup) = reinterpret_cast<FMOD_CHANNELGROUP*>(t_group);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_SetCallback                   (FMOD_EVENT *event, FMOD::EVENT_CALLBACK callback, void *userdata)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->setCallback(callback, userdata);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetParameter                  (FMOD_EVENT *event, const char *name, FMOD_EVENTPARAMETER **parameter)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD::EventParameter* e_parameter = reinterpret_cast<FMOD::EventParameter*>((*parameter));
    FMOD_RESULT result = e_event->getParameter(name, &e_parameter);
    (*parameter) = reinterpret_cast<FMOD_EVENTPARAMETER*>(e_parameter);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetParameterByIndex           (FMOD_EVENT *event, int index, FMOD_EVENTPARAMETER **parameter)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD::EventParameter* e_parameter = reinterpret_cast<FMOD::EventParameter*>((*parameter));
    FMOD_RESULT result = e_event->getParameterByIndex(index, &e_parameter);
    (*parameter) = reinterpret_cast<FMOD_EVENTPARAMETER*>(e_parameter);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetNumParameters              (FMOD_EVENT *event, int *numparameters)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->getNumParameters(numparameters);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetProperty                   (FMOD_EVENT *event, const char *propertyname, void *value)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->getProperty(propertyname, value);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetPropertyByIndex            (FMOD_EVENT *event, int propertyindex, void *value)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->getPropertyByIndex(propertyindex, value);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetNumProperties              (FMOD_EVENT *event, int *numproperties)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->getNumProperties(numproperties);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetCategory                   (FMOD_EVENT *event, FMOD_EVENTCATEGORY **category)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD::EventCategory* t_category = reinterpret_cast<FMOD::EventCategory*>((*category));
    FMOD_RESULT result = e_event->getCategory(&t_category);
    (*category) = reinterpret_cast<FMOD_EVENTCATEGORY*>(t_category);
    
    return result;
}


FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_SetVolume                     (FMOD_EVENT *event, float volume)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->setVolume(volume);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetVolume                     (FMOD_EVENT *event, float *volume)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->getVolume(volume);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_SetPitch                      (FMOD_EVENT *event, float pitch)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->setPitch(pitch);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetPitch                      (FMOD_EVENT *event, float *pitch)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->getPitch(pitch);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_SetPaused                     (FMOD_EVENT *event, bool paused)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->setPaused(paused);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetPaused                     (FMOD_EVENT *event, bool *paused)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->getPaused(paused);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_SetMute                       (FMOD_EVENT *event, bool mute)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->setMute(mute);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetMute                       (FMOD_EVENT *event, bool *mute)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->getMute(mute);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_Set3DAttributes               (FMOD_EVENT *event, const FMOD_VECTOR *position, const FMOD_VECTOR *velocity, const FMOD_VECTOR *orientation)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->set3DAttributes(position, velocity, orientation);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_Get3DAttributes               (FMOD_EVENT *event, FMOD_VECTOR *position, FMOD_VECTOR *velocity, FMOD_VECTOR *orientation)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->get3DAttributes(position, velocity, orientation);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_Set3DOcclusion                (FMOD_EVENT *event, float directocclusion, float reverbocclusion)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->set3DOcclusion(directocclusion, reverbocclusion);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_Get3DOcclusion                (FMOD_EVENT *event, float *directocclusion, float *reverbocclusion)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->get3DOcclusion(directocclusion, reverbocclusion);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_SetReverbProperties           (FMOD_EVENT *event, const FMOD_REVERB_CHANNELPROPERTIES *prop)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->setReverbProperties(prop);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_Event_GetReverbProperties           (FMOD_EVENT *event, FMOD_REVERB_CHANNELPROPERTIES *prop)
{
    FMOD::Event* e_event = reinterpret_cast<FMOD::Event*>(event);
    FMOD_RESULT result = e_event->getReverbProperties(prop);
    
    return result;
}


/*
    'EventParameter' API
*/
FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventParameter_GetInfo              (FMOD_EVENTPARAMETER *parameter, int *index, char **name)
{
    FMOD::EventParameter* e_parameter = reinterpret_cast<FMOD::EventParameter*>(parameter);
    FMOD_RESULT result = e_parameter->getInfo(index, name);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventParameter_GetRange             (FMOD_EVENTPARAMETER *parameter, float *rangemin, float *rangemax)
{
    FMOD::EventParameter* e_parameter = reinterpret_cast<FMOD::EventParameter*>(parameter);
    FMOD_RESULT result = e_parameter->getRange(rangemin, rangemax);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventParameter_SetValue             (FMOD_EVENTPARAMETER *parameter, float value)
{
    FMOD::EventParameter* e_parameter = reinterpret_cast<FMOD::EventParameter*>(parameter);
    FMOD_RESULT result = e_parameter->setValue(value);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventParameter_GetValue             (FMOD_EVENTPARAMETER *parameter, float *value)
{
    FMOD::EventParameter* e_parameter = reinterpret_cast<FMOD::EventParameter*>(parameter);
    FMOD_RESULT result = e_parameter->getValue(value);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventParameter_SetVelocity          (FMOD_EVENTPARAMETER *parameter, float value)
{
    FMOD::EventParameter* e_parameter = reinterpret_cast<FMOD::EventParameter*>(parameter);
    FMOD_RESULT result = e_parameter->setVelocity(value);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventParameter_GetVelocity          (FMOD_EVENTPARAMETER *parameter, float *value)
{
    FMOD::EventParameter* e_parameter = reinterpret_cast<FMOD::EventParameter*>(parameter);
    FMOD_RESULT result = e_parameter->getVelocity(value);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventParameter_SetSeekSpeed         (FMOD_EVENTPARAMETER *parameter, float value)
{
    FMOD::EventParameter* e_parameter = reinterpret_cast<FMOD::EventParameter*>(parameter);
    FMOD_RESULT result = e_parameter->setSeekSpeed(value);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventParameter_GetSeekSpeed         (FMOD_EVENTPARAMETER *parameter, float *value)
{
    FMOD::EventParameter* e_parameter = reinterpret_cast<FMOD::EventParameter*>(parameter);
    FMOD_RESULT result = e_parameter->getSeekSpeed(value);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventParameter_KeyOff               (FMOD_EVENTPARAMETER *parameter)
{
    FMOD::EventParameter* e_parameter = reinterpret_cast<FMOD::EventParameter*>(parameter);
    FMOD_RESULT result = e_parameter->keyOff();
    
    return result;
}


/*
    'EventReverb' API
*/
FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventReverb_Release                 (FMOD_EVENTREVERB *reverb)
{
    FMOD::EventReverb* e_reverb = reinterpret_cast<FMOD::EventReverb*>(reverb);
    FMOD_RESULT result = e_reverb->release();
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventReverb_SetProperties           (FMOD_EVENTREVERB *reverb, FMOD_REVERB_PROPERTIES *props)
{
    FMOD::EventReverb* e_reverb = reinterpret_cast<FMOD::EventReverb*>(reverb);
    FMOD_RESULT result = e_reverb->setProperties(props);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventReverb_GetProperties           (FMOD_EVENTREVERB *reverb, FMOD_REVERB_PROPERTIES *props)
{
    FMOD::EventReverb* e_reverb = reinterpret_cast<FMOD::EventReverb*>(reverb);
    FMOD_RESULT result = e_reverb->getProperties(props);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventReverb_SetActive               (FMOD_EVENTREVERB *reverb, bool active)
{
    FMOD::EventReverb* e_reverb = reinterpret_cast<FMOD::EventReverb*>(reverb);
    FMOD_RESULT result = e_reverb->setActive(active);
    
    return result;
}

FMOD_RESULT __declspec(dllexport) __cdecl FMOD_EventReverb_GetInfo                 (FMOD_EVENTREVERB *reverb, int *index, char **name)
{
    FMOD::EventReverb* e_reverb = reinterpret_cast<FMOD::EventReverb*>(reverb);
    FMOD_RESULT result = e_reverb->getInfo(index, name);
    
    return result;
}
